package com.example.liqm.eventbus;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import org.greenrobot.eventbus.EventBus;

public class SecondActivity extends AppCompatActivity {

    private TextView textView;
    private Button button;
    private Button button2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.next_activity);
        textView = (TextView) findViewById(R.id.next_tv);
        button = (Button) findViewById(R.id.next_btn);
        button2 = (Button) findViewById(R.id.next_btn2);

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {//发送信息
                EventBus.getDefault().post(new MessageEvent("修改后"));
            }
        });

        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {//发送信息
                EventBus.getDefault().post(new MessageEvent2("第二次修改"));
            }
        });
    }
}
